package com.iplant.aps.service.mesenum;

import com.iplant.aps.service.po.cfg.CFGItem;

import java.util.ArrayList;
import java.util.List;

/**
 * 领料需求订单类型
 * 
 * @author YouWang·Peng
 * @CreateTime 2022-1-6 10:13:30
 *
 */
public enum WMSPickDemandItemStatus {
	/**
	 * 保存
	 */
	Default(0, "保存"),
	/**
	 * 在线
	 */
	Online(1, "在线"),
	/**
	 * 装车
	 */
	Loaded(2, "装车"),
	/**
	 * 待退料
	 */
	ToBack(3, " 待退料"),
	/**
	 * 已退料
	 */
	Backed(4, "已退料"),
	/**
	 * 缺料
	 */
	MaterialShortage(5, "缺料"),
	/**
	 * 已分拣
	 */
	Sorted(6, "已分拣"),
	/**
	 *已删除
	 */
	Deleted(7,"已删除");

	private int value;
	private String lable;

	private WMSPickDemandItemStatus(int value, String lable) {
		this.value = value;
		this.lable = lable;
	}

	/**
	 * 通过 value 的数值获取枚举实例
	 *
	 * @param val
	 * @return
	 */
	public static WMSPickDemandItemStatus getEnumType(int val) {
		for (WMSPickDemandItemStatus type : WMSPickDemandItemStatus.values()) {
			if (type.getValue() == val) {
				return type;
			}
		}
		return WMSPickDemandItemStatus.Default;
	}

	public static List<CFGItem> getEnumList() {
		List<CFGItem> wItemList = new ArrayList<CFGItem>();

		for (WMSPickDemandItemStatus type : WMSPickDemandItemStatus.values()) {
			CFGItem wItem = new CFGItem();
			wItem.ID = type.getValue();
			wItem.ItemName = type.getLable();
			wItem.ItemText = type.getLable();
			wItemList.add(wItem);
		}
		return wItemList;
	}

	public int getValue() {
		return value;
	}

	public String getLable() {
		return lable;
	}
}
